﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using K.EnterpriseLibary.Entity;
using K.Service;
namespace K.Presentation
{
    public class ChineseDictAction
    {
        //测试

        public Character GetRandomCharacter()
        { 
            Character character = new Character();

            character = ChineseDictService.Instance.GetRandomCharacter();
            return character;
        }

        public bool SaveCharacterInfo(CharacterInfo characterInfo)
        {
            if (!ChineseDictService.Instance.InsertCharacterInfo(characterInfo))
            {
                return false;
            }
            return true;
        }

        public bool SaveCharacterInfoProvenance(List<CharacterInfoProvenance> listcharacterInfoProvenance)
        {

            foreach (var item in listcharacterInfoProvenance)
            {
                if (!ChineseDictService.Instance.InserCharacterInfoProvenance(item))
                    return false;
            }            


            return true;
        }

        public bool UpdateCharacter(Character character)
        {
            if (!ChineseDictService.Instance.UpdateCharacter(character))
            {
                return false;
            }
            return true;
        }

        public List<CharacterInfo> GetCharacterInfoList(Character character)
        {
            List<CharacterInfo> listCharacterInfo = new List<CharacterInfo>();
            return ChineseDictService.Instance.SelectCharacterInfoList(character);
        }

        public bool DeleteCharacterInfoProvenance(CharacterInfoProvenance characterInfoProvenance)
        {
            ChineseDictService.Instance.DeleteCharacterInfoProvenance(characterInfoProvenance);
            return true;
        }

        public bool DeleteCharacterInfo(CharacterInfo characterInfo)
        {
            return ChineseDictService.Instance.DeleteCharacterInfo(characterInfo);
        }
    }
}
